﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterCar.master" AutoEventWireup="true" 
    CodeFile="promo-email-confirm.aspx.cs" Inherits="car_insurance_promo_email_confirm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="container">
        <div id="divLoading" style="position: fixed; top: 0; left: 0; background-color: gray;
            filter: alpha(opacity=90); opacity: 0.8; width: 100%; height: 100%; display: none;">
            <table style="width: 100%; height: 300px">
                <tr>
                    <td align="center" valign="middle">
                        <img src="../images/loader/loader.gif" alt="Loading" width="66" height="66" align="absmiddle" />
                    </td>
                </tr>
            </table>
        </div>
        <div class="radius-box-gen">
            <div id="divCallMe" runat="server">
                <div class="field-message">
                    <asp:Label ID="lblApplicationTitle" runat="server" Text=""></asp:Label>
                </div>
                <div class="field-row">
                    <html5:TextInput ID="txtUserName" MaxLength="50" runat="server" CssClass="text-fields"
                        Text="<%$Resources:CarMenu,YourName%>"></html5:TextInput>
                    <asp:RequiredFieldValidator ID="rfvUserName" runat="server" CssClass="validationError"
                        ValidationGroup="email" ErrorMessage="" Text="" ControlToValidate="txtUserName"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revUserName" runat="server" ValidationGroup="email"
                        ValidationExpression="^[\p{L}\d]*[^#$%^&*():/\.'^<>]*$" CssClass="validationError"
                        ControlToValidate="txtUserName" ErrorMessage=""></asp:RegularExpressionValidator>
                </div>
                <div class="field-row">
                    <html5:EmailInput ID="txtUserEmail" runat="server" MaxLength="80" CssClass="text-fields"
                        Text="<%$Resources:CarInsurance,YourEmail%>"></html5:EmailInput>
                    <asp:RegularExpressionValidator ID="rfvUserEmail" Text="" CssClass="validationError"
                        runat="server" ValidationGroup="email" ErrorMessage="" ControlToValidate="txtUserEmail"
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"></asp:RegularExpressionValidator>
                    <asp:RequiredFieldValidator ID="revUserEmail" runat="server" Text="" CssClass="validationError"
                        ValidationGroup="email" ErrorMessage="" ControlToValidate="txtUserEmail" Display="Dynamic"></asp:RequiredFieldValidator>
                </div>
                <div class="field-row">
                    <html5:PhoneInput ID="txtUserMobile" runat="server" CssClass="text-fields" MaxLength="10"
                        Text="<%$Resources:CarMenu,MobileSample%>"></html5:PhoneInput>
                    <asp:RequiredFieldValidator ID="rfvUserMobile" runat="server" CssClass="validationError"
                        ValidationGroup="email" ErrorMessage="" Text="" ControlToValidate="txtUserMobile"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revUserMobile" runat="server" ValidationGroup="email"
                        ValidationExpression="0[5-9]\d{8}" ControlToValidate="txtUserMobile" CssClass="validationError"
                        ErrorMessage=""></asp:RegularExpressionValidator>
                </div>
                <div class="chkbox" id="divAgreement" runat="server">
                    <div style="padding-top: 10px; padding-bottom:10px; float: left;">
                        <asp:CheckBox ID="chkAggrement" runat="server" onclick="CheckedChanged();" />
                        <asp:Label ID="lblAggrement" runat="server"></asp:Label>
                        <asp:RequiredFieldValidator ID="rfvIsAccept" runat="server" ControlToValidate="txtIsAccept"
                            CssClass="validationError" Display="Dynamic" ErrorMessage="" ValidationGroup="email"></asp:RequiredFieldValidator>
                        <div style="display:none;">
                            <asp:TextBox ID="txtIsAccept" runat="server"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="field-row">
                    <asp:Button runat="server" ID="btnSubmit" Text="<%$Resources:ProposalForm,Submit%>" CssClass="action-button"
                        OnClick="btnSubmit_Click" ValidationGroup="email" OnClientClick="LoadValidationErrorCss();CheckedChanged();if (Page_ClientValidate('email')){ShowHideDiv('divLoading', true);}"
                        Width="100" />
                    <div style="float: left;">
                        <asp:Button runat="server" ID="Button1" Text="<%$Resources:CarMenu,Back%>" CssClass="back-button"
                            OnClick="btnBack_Click" Width="100" OnClientClick="Redirect2ResultPage();ShowHideDiv('divLoading', true);" />
                    </div>
                </div>
                <div>
                    <asp:Label ID="lblErrorMessage" runat="server" ForeColor="Red"></asp:Label>
                </div>
            </div>
            <div id="divEmailMessage" runat="server" visible="false">
                <div class="heading-radius">
                    <asp:Label ID="lblThanksTitle" runat="server" Text=""></asp:Label></div>
                <div class="thanks-text">
                    <p class="thanks-para">
                        <asp:Label ID="lblMessage1" runat="server"></asp:Label>
                    </p>
                    <p class="thanks-para">
                        <asp:Label ID="lblMessage2" runat="server"></asp:Label>
                    </p>
                </div>
                <div style="padding-left: 7px;">
                    <asp:Button runat="server" ID="btnBack" Text="<%$Resources:CarMenu,Back%>" CssClass="back-button"
                        OnClick="btnBack_Click" Width="100" OnClientClick="Redirect2ResultPage();ShowHideDiv('divLoading', true);" />
                </div>
            </div>
            <div class="logo-chac">
                <div style="position: absolute; margin: 32px 0px 0px -30px;">
                    <img src="../images/monkey-chac-cal.png" width="143" height="124" alt="" />
                </div>
            </div>
        </div>
    </div>
    <div class="social-icons">
        <div class="fb-icon">
            <a href="https://www.facebook.com/GGmotor" target="_blank">
                <img src="../images/icons/fb-icon.png" width="53" height="53" alt="" /></a></div>
        <div class="gplus-icon">
            <a href="https://plus.google.com/+Gluaygluay" target="_blank">
                <img src="../images/icons/gplus-icon.png" width="53" height="53" alt="" /></a></div>
        <div class="instagram-icon">
            <a href="http://instagram.com/ggmotor" target="_blank">
                <img src="../images/icons/instagram-variation.png" width="53" height="53" alt="" /></a></div>
        <div class="youtube-icon">
            <a href="http://www.youtube.com/channel/UCZ4gMtlXymBHxvcXO2cR1vA" target="_blank">
                <img src="../images/icons/youtube-variation.png" width="53" height="53" alt="" /></a></div>
    </div>
    <div style="display: none;">
        <asp:HiddenField ID="hdnQuoteId" runat="server" Value="0" />
        <asp:HiddenField ID="hdnCarId" runat="server" Value="0" />
        <asp:HiddenField ID="hdnPolicyId" runat="server" Value="0" />
        <asp:HiddenField ID="hdnIsAceept" runat="server" Value="FALSE" />
        <asp:HiddenField ID="hdnRedirect" runat="server" Value="0" />
    </div>
    <input id="inputLang" value="" style="display: none;" />

    <script type="text/javascript">
        function RemoveSpace(c) {
            c.value = c.value.split(' ').join('')
        }

        function DefaultName(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value.length == 0 && TextBoxEvent.type == "blur") {
                if (document.getElementById('inputLang').value == 'EN') {
                    TextBoxControl.value = "Your name ...";
                }
                else {
                    TextBoxControl.value = "ชื่อของคุณ  ...";
                }
            }
        }

        function DefaultEmail(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value.length == 0 && TextBoxEvent.type == "blur") {
                if (document.getElementById('inputLang').value == 'EN') {
                    TextBoxControl.value = "Your E-mail address ...";
                }
                else {
                    TextBoxControl.value = "อีเมล์";
                }
            }
        }

        function DefaultPhone(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value.length == 0 && TextBoxEvent.type == "blur") {
                if (document.getElementById('inputLang').value == 'EN') {
                    TextBoxControl.value = "Example: 0893998209";
                }
                else {
                    TextBoxControl.value = "ตัวอย่าง 0893998209";
                }
            }
        }

        function ClearText(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value == "Your name ...") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'EN'
            }
            if (TextBoxControl.value == "ชื่อของคุณ  ...") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'TH'
            }
            if (TextBoxControl.value == "Your E-mail address ...") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'EN'
            }

            if (TextBoxControl.value == "อีเมล์") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'TH'
            }
            if (TextBoxControl.value == "Example: 0893998209") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'EN'
            }
            if (TextBoxControl.value == "ตัวอย่าง 0893998209") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'TH'
            }
        }

        function ConfirmGoback() {
            var _retVal = false;

            _retVal = window.confirm('<%=GetGlobalResourceObject("CarMenu", "GoBack")%>');

            if (_retVal) {
                window.onbeforeunload = null;
            }

            return _retVal;
        }

        function ShowHideDiv(divName, varOnOff) {
            if (varOnOff) {
                document.getElementById(divName).style.display = "";
            }
            else {
                document.getElementById(divName).style.display = "none";
            }
        }

        function CheckedChanged() {
            var ctrlTxt = document.getElementById('<%=txtIsAccept.ClientID %>');
            var ctrlAgree = document.getElementById('<%=chkAggrement.ClientID %>');
            var lblAgree = document.getElementById('<%=lblAggrement.ClientID %>');
            ctrlTxt.value = '1';
            lblAgree.style.color = 'black';
            if (ctrlAgree.checked == false) {
                ctrlTxt.value = '';
                lblAgree.style.color = 'red';
            }
        }

        function Redirect2ResultPage() {
            var urlfrom = document.getElementById('<%= hdnRedirect.ClientID%>').value;
            window.location.href = urlfrom;
        }
    </script>

</asp:Content>

